package com.groupbuying.sysconfig.dto.mini;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Description 微信小程序模板消息消息体
 * @Auther Davidbieber
 * @Email davidbieber@163.com
 * @Date 2019/10/18 9:07 AM
 */
public class MiniWechatInfo {

    /**
     * 微信小程序用户openId
     */
    private String toUser;
    /**
     * 微信小程序模版ID
     */
    private String templateId;
    /**
     * 微信小程序消息体对应小程序页面模版路径
     */
    private String page;
    /**
     * 微信小程序表单ID--formId
     */
    private String formId;
    /**
     * 微信小程序消息体
     */
    private List<MiniDataInfo> data;
    /**
     * 微信小程序是否字体放大--不填默认不放大
     */
    private String emphasisKeyword;


    public MiniWechatInfo() { }

    MiniWechatInfo(String toUser, String templateId, String page, String formId, List<MiniDataInfo> data, String emphasisKeyword) {
        this.toUser = toUser;
        this.templateId = templateId;
        this.page = page;
        this.formId = formId;
        this.data = data;
        this.emphasisKeyword = emphasisKeyword;
    }

    public String getToUser() {
        return toUser;
    }

    public void setToUser(String toUser) {
        this.toUser = toUser;
    }

    public String getTemplateId() {
        return templateId;
    }

    public void setTemplateId(String templateId) {
        this.templateId = templateId;
    }

    public String getPage() {
        return page;
    }

    public void setPage(String page) {
        this.page = page;
    }

    public String getFormId() {
        return formId;
    }

    public void setFormId(String formId) {
        this.formId = formId;
    }

    public List<MiniDataInfo> getData() {
        return data;
    }

    public void setData(List<MiniDataInfo> data) {
        this.data = data;
    }

    public String getEmphasisKeyword() {
        return emphasisKeyword;
    }

    public void setEmphasisKeyword(String emphasisKeyword) {
        this.emphasisKeyword = emphasisKeyword;
    }

    /**
     * 根据添加Data定义消息体list
     * @param dataInfo
     * @return
     */
    public  MiniWechatInfo addData(MiniDataInfo dataInfo){
        if(this.data==null){
            this.data=new ArrayList<>();
        }
        this.data.add(dataInfo);
        return this;
    }

    public static MiniWechatInfo.MiniWechatInfoBuilder builder(){
        return new MiniWechatInfo.MiniWechatInfoBuilder();
    }

    /**
     * 模板消息构造器
     */
    public static class MiniWechatInfoBuilder{
        private String toUser;
        private String templateId;
        private String page;
        private String formId;
        private List<MiniDataInfo> data;
        private String emphasisKeyword;

        MiniWechatInfoBuilder(){};

        public MiniWechatInfoBuilder toUser(String toUser) {
            this.toUser = toUser;
            return this;
        }

        public MiniWechatInfoBuilder templateId(String templateId) {
            this.templateId = templateId;
            return this;
        }

        public MiniWechatInfoBuilder page(String page) {
            this.page = page;
            return this;
        }

        public MiniWechatInfoBuilder fromId(String formId) {
            this.formId = formId;
            return this;
        }

        public MiniWechatInfoBuilder data(List<MiniDataInfo> data) {
            this.data = data;
            return this;
        }

        public MiniWechatInfoBuilder emphasisKeyword(String emphasisKeyword) {
            this.emphasisKeyword = emphasisKeyword;
            return this;
        }

        public MiniWechatInfo build(){
            return new MiniWechatInfo(this.toUser,this.templateId,this.page,this.formId,this.data,this.emphasisKeyword);
        }

        @Override
        public String toString(){
            return "MiniWechatInfo.MiniWechatInfoBuilder(toUser="+this.toUser+",templateId="+this.templateId+",page="+this.page+",formId="+this.formId+",data="+this.data+",emphasisKeyword="+this.emphasisKeyword+")";
        }
    }
}
